
use wsample1, clear


set more off, perm
 


#delimit ;
global labels 
	"
	r_loss "Memory loss" 
	r_decline_nloss "Pessimist" 
	r_loss_a "Aware" 
	r_loss_u "Unaware" 
	mean "Mean Wealth"
	ymean "Mean Change"
	exp_diff "predicted $\Delta$ Wealth"
	"
	;
#delimit cr


  cap log close 
log using additional_for_referees, replace
  qui {

  
       noi disp "Main Table"
global X0 "c.age##c.age "
global X "$X0 i.mstat  college hs i.lbrf ragender i.raracem i.cendiv ad_impw_atotb"


qui {
	replace lnh_atotb=ln(h_atotb+1) 
	 
local list h_atotbc lnh_atotbc h_atotb lnh_atotb
 
foreach y of local list  {
	
		if "`y'"=="h_atotbc"  {
		local M FD

	}
	
	if "`y'"=="lnh_atotbc" {
		local M LnFD

	}

	if "`y'"=="h_atotb" {
		local M L
		local i  hhidpn age

	}
	if  "`y'"=="lnh_atotb" {
		local M LnL
		local i  hhidpn age
	}


	
   reghdfe `y'   r_decline_nloss r_loss_a r_loss_u lqrec   $X if lfinr==1 [pw=wtresp] , absorb (`i' t) cluster (hhid)
   est store  `M'_W0
   
	reghdfe `y'  r_decline_nloss r_loss_a r_loss_u lqrec lh_atotb  $X if lfinr==1 [pw=wtresp] , absorb( t `i') cluster (hhid)
   est store `M'_W1

   
	reghdfe `y'   r_decline_nloss r_loss_a r_loss_u lqrec   $X if lfinr==1 & q4bw==4 [pw=wtresp] , absorb(t `i') cluster (hhid)
   est store  `M'_W0_Q4
   
	reghdfe `y'   r_decline_nloss r_loss_a r_loss_u lqrec lh_atotb  $X if lfinr==1 & q4bw==4 [pw=wtresp] , absorb(t `i') cluster (hhid)
   est store  `M'_W1_Q4

      reghdfe `y'   r_decline_nloss r_loss r_loss_u lqrec   $X if lfinr==1 [pw=wtresp] , absorb(t `i') cluster (hhid)
   est store  `M'_W0_t
   
    reghdfe `y'  r_decline_nloss r_loss r_loss_u lqrec lh_atotb  $X if lfinr==1 [pw=wtresp] , absorb(t `i') cluster (hhid)
   est store `M'_W1_t

	reghdfe `y'   r_decline_nloss r_loss r_loss_u lqrec   $X if lfinr==1 & q4bw==4 [pw=wtresp] , absorb(t `i') cluster (hhid)
   est store  `M'_W0_Q4_t
	reghdfe `y'   r_decline_nloss r_loss r_loss_u lqrec lh_atotb  $X if lfinr==1 & q4bw==4 [pw=wtresp] , absorb(t `i') cluster (hhid)
   est store  `M'_W1_Q4_t


}
**********************************************************************************************************************************************************************************
*These tables show the robustness of our results to alternative specifications:
*Linear model vs. First differences, Individual fixed effects, controlling or not for wealth at t-1
**********************************************************************************************************************************************************************************
 
 
 
noi estout	  FD_W0 FD_W1 FD_W0_Q4 FD_W1_Q4 LnFD_W1 LnFD_W0 LnFD_W0_Q4 LnFD_W1_Q4, 		///
style(tex) stard cells(b(star fmt(%9.3f)) se(par)) stats(N max mean ymean ,labels("Obs." "N" "Mean" "Mean" ) fmt(%9.5g))  ///
	starlevels(* 0.100 ** 0.05 *** 0.01)  	 keep( r_loss_a r_loss_u) varl( $labels ) nolz	
	
noi estout	  FD_W0_t FD_W1_t FD_W0_Q4_t FD_W1_Q4_t LnFD_W1_t LnFD_W0_t LnFD_W0_Q4_t LnFD_W1_Q4_t, 		///
style(tex) stard cells(b(star fmt(%9.3f)) se(par))   ///
	starlevels(* 0.100 ** 0.05 *** 0.01)  	 keep( r_loss_u) varl( $labels ) nolz	
	
	
noi estout	  L_W0 L_W1 L_W0_Q4 L_W1_Q4 LnL_W1 LnL_W0 LnL_W0_Q4 LnL_W1_Q4, 		///
style(tex) stard cells(b(star fmt(%9.3f)) se(par)) stats(N max mean ymean ,labels("Obs." "N" "Mean" "Mean" ) fmt(%9.5g))  ///
	starlevels(* 0.100 ** 0.05 *** 0.01)  	 keep( r_loss_a r_loss_u) varl( $labels ) nolz	
	
noi estout	  L_W0_t L_W1_t L_W0_Q4_t L_W1_Q4_t LnL_W1_t LnL_W0_t LnL_W0_Q4_t LnL_W1_Q4_t, 		///
style(tex) stard cells(b(star fmt(%9.3f)) se(par))   ///
	starlevels(* 0.100 ** 0.05 *** 0.01)  	 keep( r_loss_u) varl( $labels ) nolz	

}




  
